package hos.http;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.List;
import java.util.Map;

/**
 * <p>Title: HttpBaseRequestBody </p>
 * <p>Description:  </p>
 * <p>Company: www.mapuni.com </p>
 *
 * @author : 蔡俊峰
 * @version : 1.0
 * @date : 2023/3/2 20:25
 */
public interface HttpBaseRequestBody<T extends HttpBaseRequestBody<T>> extends HttpBaseRequest<T> {

    T data(Object data);

    T txt(String txt);

    T bytes(byte[] bytes);

    //<editor-fold desc="File">
    T file(String name, String file);

    T file(String name, List<String> files);

    T file(String name, String fileName, String file);

    T file(List<HttpFile> list);

    List<HttpFile> getFileList();

    /**
     * 添加下载进度监听
     *
     * @param listener 监听事件
     */
    T addUploadListener(ProgressListener listener);

    HttpTag.UploadListeners uploadProgressListeners();

    //</editor-fold>

    //<editor-fold desc="JSON">

    /**
     * 添加Json为请求体
     */
    T json(JSONObject body);

    /**
     * 添加Json为请求体
     */
    T json(JSONArray body);

    /**
     * 添加Json为请求体
     */
    T json(String body);

    /**
     * 添加Json为请求体
     */
    T json(Map<String, ?> body);

    /**
     * 添加Json为请求体
     */
    T json(List<Map<String, ?>> body);
    //</editor-fold>


    Object getData();

    T isFormEncoded(boolean isFormEncoded);

    T isMultipart(boolean isMultipart);

    boolean isFormEncoded();

    boolean isMultipart();

}
